package com.android.porttallymansystem.logic.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import com.android.porttallymansystem.logic.model.Msg

@Dao
interface MsgDao {

    @Insert
    fun insertMsg(msg: Msg): Long

    @Query("select * from Msg where receiverId = :receiverId")
    fun loadMsgByReceiverId(receiverId: Long): List<Msg>

    @Query("select * from Msg where senderId = :senderId")
    fun loadMsgBySenderId(senderId: Long): List<Msg>

    @Query("select * from Msg where senderId = :senderId and receiverId = :receiverId")
    fun loadMsg(senderId: Long, receiverId: Long): List<Msg>
}